<% lcase.language_case_rules.each_with_index do |rule, rule_index| %>
    <div class="language_case_rule" style="">
    	<table style="width:100%;">
    		<tr>
    			<td class="tr8n_txtl" style="width:1%; padding-right:10px;white-space:nowrap;">
	          <% if rule_index == 0 %>
	             <%=image_tag('tr8n/arrow_up_grey.png') %>
	          <% else %>
	             <%=link_to_function(image_tag('tr8n/arrow_up.png'), "moveLanguageCaseRule('#{case_index}', '#{rule_index}', 'up')") %>
	          <% end %> 
	          
	          <% if rule_index == lcase.language_case_rules.size - 1 %>
	             <%=image_tag('tr8n/arrow_down_grey.png') %>
	          <% else %>
	             <%=link_to_function(image_tag('tr8n/arrow_down.png'), "moveLanguageCaseRule('#{case_index}', '#{rule_index}', 'down')") %>
	          <% end %>
	          
	          <%=link_to_function(image_tag("tr8n/add.png"), "addLanguageCaseRule('#{case_index}', '#{rule_index+1}')", :id => "language_case_edit_link_#{rule_index}")%>
    			</td>
					<td class="tr8n_txtl" style="vertical-align:middle;color:#444;">
		        <span dir="ltr" style="font-weight:bold;color:black;"><%=rule_index+1%>.</span> <span dir="ltr"><%=rule.description %></span>
							
		        <% rule_prefix = "cases[#{case_index}][rules][#{rule_index}]" %>
		
		        <%=hidden_field_tag("#{rule_prefix}[position]", rule_index)%>
		        <%=hidden_field_tag("#{rule_prefix}[definition][gender]", rule.definition[:gender])%>
		        <%=hidden_field_tag("#{rule_prefix}[definition][part1]", rule.definition[:part1])%>
		        <%=hidden_field_tag("#{rule_prefix}[definition][value1]",  rule.definition[:value1])%>
		        <%=hidden_field_tag("#{rule_prefix}[definition][multipart]", rule.definition[:multipart].to_s)%>
		        <%=hidden_field_tag("#{rule_prefix}[definition][operator]", rule.definition[:operator])%>
		        <%=hidden_field_tag("#{rule_prefix}[definition][part2]", rule.definition[:part2])%>
		        <%=hidden_field_tag("#{rule_prefix}[definition][value2]", rule.definition[:value2])%>
		        <%=hidden_field_tag("#{rule_prefix}[definition][operation]", rule.definition[:operation])%>
		        <%=hidden_field_tag("#{rule_prefix}[definition][operation_value]", rule.definition[:operation_value])%>
					</td>
					<td class="tr8n_txtl" style="width:1%; text-align:right;white-space:nowrap;">
	          <%=link_to_function(image_tag("tr8n/pencil.png"), "editLanguageCaseRule('#{case_index}', '#{rule_index}')", :id => "language_case_edit_link_#{rule_index}")%>
	          <%=link_to_function(image_tag("tr8n/cross.png"), "deleteLanguageCaseRule('#{case_index}', '#{rule_index}')")%>
					</td>
    		</tr>
    	</table>
    </div>
<% end %>

<div class="tr8n_txtl" style="font-size: 12px; color: grey; padding:5px; padding-top:10px;">
  <%=link_to_function(tra(" + Add Language Case Rule"), "addLanguageCaseRule('#{case_index}', '0')")%>
</div>

